Class symantec.itools.awt.TabPanel
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.TabPanel

Object
   |
   +----Component
           |
           +----Container
                   |
                   +----Panel
                           |
                           +----BaseTabbedPanel
                                   |
                                   +----symantec.itools.awt.TabPanel

public class TabPanel
extends BaseTabbedPanel
implements Serializable
TabPanel is a Panel extension which provides for a tabbed dialog effect. Along the top (by default) of the panel is a series of file folder-like tabs, each with a text label. Each tab is associated with a panel or component that gets shown when the user clicks on the tab. The TabPanel automatically manages swapping panels when a tab selected. It can be used directly or extended. When extending from TabPanel be sure to super() during construction and to super.handleEvent(evt) from handleEvent if you override it.

Author:
Scott Fauerbach

Constructor Index

 o symantec.itools.awt.TabPanel()
Constructs a TabPanel with tabs on top, rounded
 o symantec.itools.awt.TabPanel(boolean)
Obsolete.
 o symantec.itools.awt.TabPanel(int, int)
Constructs a TabPanel with the tabs in the given position and having the specified look.

Method Index

 o add(Component)
Adds a component to the end of this container.
 o add(Component, int)
Adds a component to the end of this container.
 o add(String, Component)
Takes no action.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all event changes.
 o addTabPanel(String, boolean, Component)
Appends a new tab and associated panel, which will be shown when the tab is selected.
 o addTabPanel(String, boolean, Component, int)
Adds a new tab and associated panel.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all event changes.
 o countTabs()
Gets the number of tab panels in the TabPanel.
 o enableTabPanel(boolean, int)
Conditionally enables a tab and its associated panel at the given index.
 o getCurrentPanelNdx()
Returns the zero-relative index of the currently selected panel.
 o getMinimumSize()
Returns the minimum dimensions to properly display this component.
 o getPanelLabel(int)
Gets the current tab label associated with the current panels at the given index.
 o getPanelLabels()
Gets the current tab labels associated with the panel positions.
 o getPanelTabIndex(Component)
Gets the index for a specific panel.
 o getPreferredSize()
Returns the recommended dimensions to properly display this component.
 o getTabPanel(int)
Gets the panel for the tab at the given index.
 o getTabsOnBottom()
 o insertTabPanel(String, boolean, Component, int)
Inserts a tab panel based on index.
 o isTabsOnBottom()
Gets whether the tabs are at the bottom of the dialog.
 o remove(Component)
Removes the specified component from this container.
 o removeAllTabPanels()
Removes all tabs and their associated panels, clearing the TabPanel entirely.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all event changes.
 o removeTabPanel(int)
Removes a tab and its associated panel at the given index.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all event changes.
 o setCurrentPanelNdx(int)
Selects the specified tab and shows its associated panel.
 o setPanelLabel(String, int)
Sets the tab label associated with the current panels at the given index.
 o setPanelLabels(String[])
Sets the tab labels associated with the panel positions.
 o setTabPanel(String, boolean, Component, int)
Replaces a tab and its associated panel at the index specified.
 o setTabsOnBottom(boolean)
Puts the tabs on the top or bottom of the dialog.
 o showTabPanel(int)
Selects the tab at the given index, showing it and its associated panel.
 o updatePanelLabels()
This routine re-sets all the tab labels using the latest string array provided in setPanelLabels().

Constructors

 o TabPanel
public TabPanel()
Constructs a TabPanel with tabs on top, rounded

 o TabPanel
public TabPanel(boolean bTabsOnTop)
Obsolete. Use TabPanel(int tabsPostion, int tabsStyle).

 o TabPanel
public TabPanel(int tabsPostion,
                int tabsStyle)
Constructs a TabPanel with the tabs in the given position and having the specified look. Note that if the tabs are on top, then they always are rounded.

Parameters:
tabsPosition - a constant indicating TOP or BOTTOM
tabsStyle - a constant indicating ROUNDED or SQUARE
See Also:
TOP, BOTTOM, ROUNDED, SQUARE

Methods

 o add
public java.awt.Component add(Component comp)
Adds a component to the end of this container. This is a standard Java AWT method which gets called to add a component to a container. The specified component is added to the end of this container.

If the tab label for this position has not been set it is given the name "tab - #", where # is the zero-relative index of its position.

Parameters:
comp - the component to add
Returns:
the added component
Overrides:
add in class BaseTabbedPanel
See Also:
remove
 o add
public synchronized java.awt.Component add(Component comp,
                                           int pos)
Adds a component to the end of this container. This is a standard Java AWT method which gets called to add a component to a container. Typically, the specified component is added to this container at the given zero-relative position index. A position index of -1 would append the component to the end.

It is overridden so that it only appends to the TabPanel.

If the tab label for this position has not been set it is given the name "tab - #", where # is the zero-relative index of its position.

Parameters:
comp - the component to add
pos - the zero-relative index at which to add the component or -1 for end (IGNORED)
Returns:
the added component
Overrides:
add in class BaseTabbedPanel
See Also:
remove
 o add
public synchronized java.awt.Component add(String name,
                                           Component comp)
Takes no action. This is a standard Java AWT method which gets called to add a component to a container. It is overridden here to do nothing, so the user cannot change the way this container works.

Parameters:
name - the positioning directive for the layout manager (IGNORED)
comp - the component to add (IGNORED)
Returns:
the component parameter
Overrides:
add in class BaseTabbedPanel
 o addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all event changes.

Parameters:
listener - the listener to add.
Overrides:
addPropertyChangeListener in class BaseTabbedPanel
See Also:
removePropertyChangeListener
 o addTabPanel
public int addTabPanel(String sLabel,
                       boolean bEnabled,
                       Component panel)
Appends a new tab and associated panel, which will be shown when the tab is selected. The tab/panel is added after the last existing panel.

Parameters:
sLabel - the tab label
bEnabled - enable the tab or not
panel - the panel to associate with the tab
Returns:
the zero-relative index of the newly added tab panel
 o addTabPanel
public int addTabPanel(String sLabel,
                       boolean bEnabled,
                       Component panel,
                       int pos)
Adds a new tab and associated panel. The tab/panel is added at the specified index.

Parameters:
sLabel - the tab label
bEnabled - enable the tab or not
panel - the panel to associate with the tab
pos - the zero-relative index of the new tab panel
Returns:
the zero-relative index of the newly added tab panel
 o addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all event changes.

Parameters:
listener - the listener to add.
Overrides:
addVetoableChangeListener in class BaseTabbedPanel
See Also:
removeVetoableChangeListener
 o countTabs
public int countTabs()
Gets the number of tab panels in the TabPanel.

Returns:
the number of tab panels currently in the TabPanel
 o enableTabPanel
public synchronized void enableTabPanel(boolean bEnable,
                                        int index) throws PropertyVetoException
Conditionally enables a tab and its associated panel at the given index. The currently active tab cannot be disabled.

Parameters:
bEnable - true to enable, false to disable
index - the zero-relative index of the tab
Throws: PropertyVetoException
if the specified property value is unacceptable
 o getCurrentPanelNdx
public int getCurrentPanelNdx()
Returns the zero-relative index of the currently selected panel.

Returns:
the currently selected panel or -1 if none are shown
See Also:
setCurrentPanelNdx
 o getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Overrides:
getMinimumSize in class BaseTabbedPanel
See Also:
getPreferredSize
 o getPanelLabel
public java.lang.String getPanelLabel(int labelIndex)
Gets the current tab label associated with the current panels at the given index.

Parameters:
int - labelIndex an index in the array of tab labels for the current panels.
Returns:
String the label of the panel at the given index. Null if the index is out of range.
See Also:
setPanelLabel
 o getPanelLabels
public java.lang.String[] getPanelLabels()
Gets the current tab labels associated with the panel positions.

Returns:
an array of tab labels for the panel positions
See Also:
setPanelLabels
 o getPanelTabIndex
public synchronized int getPanelTabIndex(Component panel)
Gets the index for a specific panel.

Parameters:
panel - the panel to get the index of
Returns:
the zero-relative index of the panel or -1 if it is not found
 o getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

The returned size is large enough to display the biggest tab panel at its preferred size.

Overrides:
getPreferredSize in class BaseTabbedPanel
See Also:
getMinimumSize
 o getTabPanel
public synchronized java.awt.Component getTabPanel(int index)
Gets the panel for the tab at the given index.

Parameters:
index - zero-relative index of the tab
Returns:
returns the Panel associated with the tab
See Also:
setTabPanel
 o getTabsOnBottom
public boolean getTabsOnBottom()
Note: getTabsOnBottom() is deprecated.

See Also:
isTabsOnBottom()
 o insertTabPanel
public synchronized void insertTabPanel(String sLabel,
                                        boolean bEnabled,
                                        Component panel,
                                        int index)
Inserts a tab panel based on index.

Parameters:
sLabel - Label of the new tab to insert
bEnabled - If the new tab is enabled or not
panel - The panel to insert
index - zero-relative index at which the tab panel will be inserted.
 o isTabsOnBottom
public boolean isTabsOnBottom()
Gets whether the tabs are at the bottom of the dialog.

Returns:
true if the tabs are at the bottom of the dialog, false if they are at the top
See Also:
setTabsOnBottom
 o remove
public synchronized void remove(Component comp)
Removes the specified component from this container. This is a standard Java AWT method which gets called to remove a component from a container. When this happens the component's removeNotify() will also get called to indicate component removal.

Parameters:
comp - the component to remove
Overrides:
remove in class BaseTabbedPanel
See Also:
removeAll, add
 o removeAllTabPanels
public synchronized void removeAllTabPanels()
Removes all tabs and their associated panels, clearing the TabPanel entirely.

 o removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all event changes.

Parameters:
listener - the listener to remove.
Overrides:
removePropertyChangeListener in class BaseTabbedPanel
See Also:
addPropertyChangeListener
 o removeTabPanel
public synchronized void removeTabPanel(int index)
Removes a tab and its associated panel at the given index. The currently active tab cannot be removed.

Parameters:
index - zero-relative index of the tab
 o removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all event changes.

Parameters:
listener - the listener to remove.
Overrides:
removeVetoableChangeListener in class BaseTabbedPanel
See Also:
addVetoableChangeListener
 o setCurrentPanelNdx
public void setCurrentPanelNdx(int index) throws PropertyVetoException
Selects the specified tab and shows its associated panel.

Parameters:
index - the zero-relative index of the tab to select
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getCurrentPanelNdx
 o setPanelLabel
public void setPanelLabel(String newLabel,
                          int labelIndex) throws PropertyVetoException
Sets the tab label associated with the current panels at the given index.

Parameters:
String - newLabel the label to use for the tab at the given index.
int - labelIndex an index in the array of tab labels for the current panels.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getPanelLabel
 o setPanelLabels
public void setPanelLabels(String[] sLabels) throws PropertyVetoException
Sets the tab labels associated with the panel positions. Note that the panels do not need to have been added yet for this method to work.

Parameters:
sLabels - an array of tab labels for the panel positions
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getPanelLabels
 o setTabPanel
public synchronized void setTabPanel(String sLabel,
                                     boolean bEnabled,
                                     Component panel,
                                     int index) throws PropertyVetoException
Replaces a tab and its associated panel at the index specified. If it is desired to only change the label, use the base class BaseTabbedPanel's method setTab(String sLabel, boolean bEnabled, int index).

Parameters:
sLabel - the new tab label
bEnabled - enable the tab or not
panel - the new panel
index - the zero-relative index of the tab to change
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
setTab, getTabPanel
 o setTabsOnBottom
public void setTabsOnBottom(boolean bTabsOnBottom) throws PropertyVetoException
Puts the tabs on the top or bottom of the dialog.

Parameters:
bTabsOnBottom - if true the tabs are placed at the bottom of the dialog, if false on top
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getTabsOnBottom
 o showTabPanel
public synchronized void showTabPanel(int index)
Selects the tab at the given index, showing it and its associated panel. The panel is activated, ready for user input. The tab position must be enabled.

Parameters:
index - zero-relative index of the tab to select
See Also:
enableTabPanel
 o updatePanelLabels
public void updatePanelLabels()
This routine re-sets all the tab labels using the latest string array provided in setPanelLabels(). It is not typically called directly.

See Also:
setPanelLabels

All Packages  Class Hierarchy  This Package  Previous  Next  Index